package subject_set.top101;

import java.util.Stack;

/**
 * @author haomin
 * @date 2022/11/02 22:30
 **/
public class BM42 {

    public class Solution {
        Stack<Integer> stack1 = new Stack<Integer>();
        Stack<Integer> stack2 = new Stack<Integer>();

        public void push(int node) {
            stack1.push(node);
        }

        public int pop() {
            if(stack2.isEmpty()){
                while(!stack1.isEmpty()) stack2.push(stack1.pop());
            }
            return stack2.isEmpty() ? -1 : stack2.pop();
        }
    }

}